﻿<UserControl xmlns:dataInput="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input"  x:Class="FilesUploader.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:converter="clr-namespace:FilesUploader.Converters"
    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480" Loaded="UserControl_Loaded" HorizontalContentAlignment="Stretch">
    <UserControl.Resources>
        <converter:UploadStateToBackground x:Key="UploadStateToBackground" /> 
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" HorizontalAlignment="Stretch" >
        <!--<Grid x:Name="LayoutRoot" Background="#191919" HorizontalAlignment="Stretch" >-->
            <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <HyperlinkButton x:Name="filesUpload" MaxHeight="35" Content="Upload files" Click="filesUpload_Click" FontFamily="Tahoma" FontSize="15"></HyperlinkButton>
        <ListBox x:Name="filesState" ItemsSource="{Binding Photos}" Grid.Row="1" FontFamily="Tahoma" FontSize="11" BorderThickness="0" HorizontalContentAlignment="Stretch" HorizontalAlignment="Stretch" >
            <ListBox.ItemTemplate >
                <DataTemplate>
                    <StackPanel HorizontalAlignment="Stretch" MinWidth="120" >
                        <StackPanel Orientation="Horizontal">
                            <TextBlock  Text="{Binding PhotoName}" ></TextBlock>
                            <TextBlock  Text="  Error" Foreground="Red" Visibility="{Binding InError}"></TextBlock>
                        </StackPanel>
                        <ProgressBar x:Name="progress" Value="{Binding Percentage}" HorizontalAlignment="Stretch" MinHeight="10" Foreground="{Binding UploadState, Converter={StaticResource UploadStateToBackground}}"></ProgressBar>
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <TextBlock x:Name="mess" Grid.Row="2" Text="{Binding Mess}" Height="20" />
    </Grid>
</UserControl>
